/*
 * PointC.cpp
 *
 *  Created on: May 10, 2011
 *      Author: root
 */

#include <cmath>
#include "PointC.h"
#include <iostream>
using namespace std;

PointC::PointC(){
	x=0.0;
	y=0.0;
}
PointC::PointC(float a, float b){
	x=a;
	y=b;
}

float PointC::getRho(){
	return sqrt(x*x+y*y);
}
float PointC::getTheta(){
	if(x == y && x == 0.0) {
		cerr << " Cannot compute Theta x & y are zero "  << endl;
		exit(1);
	} else return atan(y/x);
}

void PointC::Trans(float a, float b){
	x=this->getX()+a;
	y=this->getY()+b;
	}

void PointC::Rot(float t){
	t=t*(M_PI/180.0);
	float theta=this->getTheta()+t;
	float rho=this->getRho();
	x=rho*cos(theta);
	y=rho*sin(theta);
}
